<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        th,td{
            width: 200px;
            height: 80px;
        }
        thead tr{
            background-image: linear-gradient(to left,rgb(197, 90, 108), orange);
        }
        thead tr th{
            color: #fff;
        }
        tbody tr{
            background-color: bisque;
        }
        tbody tr:hover{
            background-image: linear-gradient(to left,skyblue,yellow);
        }
        .xh{
            border-top-left-radius: 15px;
        }
        .jx{
            border-top-right-radius: 15px;
        }
        tbody td{
            font-size: 18px;
        }
        .jiaxiang{
            color: rgb(222, 113, 131);
        }
    </style>
</head>
<body>
    <table align="center">
        <thead>
            <tr>
                <th class="xh">序号</th>
                <th>姓名</th>
                <th>年龄</th>
                <th>性别</th>
                <th class="jx">家乡</th>
            </tr>
        </thead>
        <tbody align="center">
        
        </tbody>
    </table>
</body>
</html>
<script>
     let data = [
      { name: '小明', age: 18, sex: '男', hometown: '河北省' },
      { name: '小红', age: 19, sex: '女', hometown: '河南省' },
      { name: '小刚', age: 17, sex: '男', hometown: '山西省' },
      { name: '小丽', age: 18, sex: '女', hometown: '山东省' }
    ]
    var tb=document.querySelector("tbody")
    for(i=0;i<data.length;i++){
        var tr=document.createElement("tr")
        tr.innerHTML=`
            <td>${i+1}</td>
            <td>${data[i].name}</td>
            <td>${data[i].age}</td>
            <td>${data[i].sex}</td>
            <td class='jiaxiang'>${data[i].hometown}</td>
        `;
        tb.appendChild(tr)
    }
</script>